package org.uds.android.fitdroid.demo.activity.misc;

import org.uds.android.fitdroid.demo.apis.R;

import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;

public class MainActivity extends MapActivity {

	
	private MapView map = null;
	private MapController mapCon;

	final private int menuMode = Menu.FIRST;
	final private int menuExit = Menu.FIRST + 1;

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.mapview);

		//MapView
		map = (MapView) findViewById(R.id.map);
		map.setTraffic(true);
		map.setSatellite(false);
		map.setStreetView(true);
		map.setBuiltInZoomControls(true);

		GeoPoint geoBeijing = new GeoPoint((int) (39.95 * 1000000),
				(int) (116.37 * 1000000));
		mapCon = map.getController();
		mapCon.setCenter(geoBeijing);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		menu.add(0, menuMode, 0, "????");
		menu.add(0, menuExit, 1, "??");
		return super.onCreateOptionsMenu(menu);
	}

	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		return super.onKeyDown(keyCode, event);
	}

	@Override
	public boolean onMenuItemSelected(int featureId, MenuItem item) {
		switch (item.getItemId()) {
		case menuExit:
			finish();
			break;
		
		default:
			break;
		}
		return super.onMenuItemSelected(featureId, item);
	}

	@Override
	protected boolean isRouteDisplayed() {
		return false;
	}
}